package com.doit.day04

class IterableScalaDemo extends Iterable[ScalaHero]{
  override def iterator: Iterator[ScalaHero] = new IteratorScalaDemo
}


object IterableScalaDemo1{
  def main(args: Array[String]): Unit = {
    val demo: IterableScalaDemo = new IterableScalaDemo
    val iterator: Iterator[ScalaHero] = demo.iterator
    while (iterator.hasNext){
      println(iterator.next())
    }
  }
}